package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teaching.domain.PlatformFZone;
import com.ruoyi.teaching.domain.PlatformMMap;
import com.ruoyi.teaching.service.PlatformFZoneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.validation.Valid;

/**
 * <p>
 * 论坛专区管理 前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2024-10-14
 */
@RestController
@RequestMapping("/platform/zone")
@Api(tags = "platform-f-专区管理")
@Validated
public class PlatformFZoneController {
    @Autowired
    private PlatformFZoneService platformFZoneService;

    /**
     * 分页查询所有专区
     */
    @GetMapping("/zoneList")
    @ApiOperation(value = "分页查询所有专区", notes = "分页查询所有专区")
    public AjaxResult zoneList(Integer pageNum, Integer pageSize, String zoneName,Integer sort) {
        return platformFZoneService.zoneList(pageNum, pageSize, zoneName,sort);
    }

    /**
     * 新增专区
     */
    @PostMapping("/addZone")
    @ApiOperation(value = "新增专区", notes = "新增专区")
    @Log(title = "【新增专区】", businessType = BusinessType.INSERT)
    public AjaxResult addZone(@Valid @RequestBody PlatformFZone platformFZone) {
        return platformFZoneService.addZone(platformFZone);
    }

    /**
     * 修改专区
     */
    @PostMapping("/updateZone")
    @ApiOperation(value = "修改专区", notes = "修改专区")
    @Log(title = "【修改专区】", businessType = BusinessType.UPDATE)
    public AjaxResult updateZone(@RequestBody PlatformFZone platformFZone) {
        return platformFZoneService.updateZone(platformFZone);
    }

    /**
     * 批量删除专区
     */
    @DeleteMapping("/deleteZone/{ids}")
    @ApiOperation(value = "批量删除专区", notes = "批量删除专区")
    @Log(title = "【批量删除专区】", businessType = BusinessType.DELETE)
    public AjaxResult deleteZone(@PathVariable("ids") Long[] ids) {
        return platformFZoneService.deleteZoneByIds(ids);
    }

}

